<template>
	<view style="touch-action: none;">
		<view class="home" style="position:fixed;" :style="{ top: top + 'px'}" id="right-nav" @touchmove.stop.prevent="setTouchMove">
			<view class="gobus-block shadow" @click="onRaised">
				<view class="display-flex display-flex-column display-flex-align-center " sy>
					<image src="../../static/images/bus/buscode.png" style="width: 25px;height: 25px;margin-bottom: 5px;"></image>
					<view class="" style="color: #ffffff;font-size: 12px;">
						乘车码
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		mapGetters
	} from "vuex";
	export default {
		name: "go_bus",
		props: {},
		data: function() {
			return {
				top: "300"
			};
		},
		
		computed: mapGetters(["homeActive"]),
		created() {
			var that = this
			uni.getSystemInfo({
				success: function(res) {
					console.log("212",res)
					that.top = res.windowHeight - res.safeArea.top  -220
				}
			});
		},
		methods: {
			setTouchMove(e) {
				var that = this;
				if (e.touches[0].clientY < 545 && e.touches[0].clientY > 66) {
					that.top = e.touches[0].clientY
					// that.setData({
					// 	top: e.touches[0].clientY
					// })
				}
			},
			onRaised(){
				uni.vibrateShort({});
				// #ifdef MP-ALIPAY
				my.ap.openURL({
				  url: 'alipays://platformapi/startapp?appId=20002047', // 请将 url 替换为有效的页面地址
				  success: (res) => {
				    console.log('openURL success', res)
				  },
				  fail: (err) => {
				    console.log('openURL success', err)
				  }
				});
				 // #endif
			}
			// open: function() {
			// 	this.homeActive ?
			// 		this.$store.commit("CLOSE_HOME") :
			// 		this.$store.commit("OPEN_HOME");
			// }
		}
	};
</script>

<style scoped lang="scss">
	.pictrueBox {
		width: 130rpx;
		height: 120rpx;
	}

	/*返回主页按钮*/
	.home {
		position: fixed;
		color: white;
		text-align: center;
		z-index: 9999;
		right: 15rpx;
		display: flex;
	}

    .gobus-block{
		border-radius: 50%;
		width: 70px;
		height: 70px;
		background-color: #007AFF;
		padding: 12px;
	}
	.home .homeCon {
		border-radius: 50rpx;
		opacity: 0;
		height: 0;
		color: $theme-color;
		width: 0;
	}

	.home .homeCon.on {
		opacity: 1;
		animation: bounceInRight 0.5s cubic-bezier(0.215, 0.610, 0.355, 1.000);
		width: 300rpx;
		height: 86rpx;
		margin-bottom: 20rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		/* background: #f44939 !important; */
		@include main_bg_color(theme);
	}

	.home .homeCon .iconfont {
		font-size: 48rpx;
		color: #fff;
		display: inline-block;
		margin: 0 auto;
	}

	.home .pictrue {
		width: 86rpx;
		height: 86rpx;
		border-radius: 50%;
		margin: 0 auto;
	}

	.home .pictrue .image {
		@include main_bg_color(theme);
		width: 100%;
		height: 100%;
		border-radius: 50%;
		transform: rotate(90deg);
		ms-transform: rotate(90deg);
		moz-transform: rotate(90deg);
		webkit-transform: rotate(90deg);
		o-transform: rotate(90deg);
	}
</style>
